1 /*
2 
3 Boost Software License - Version 1.0 - August 17th, 2003
4 
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license (the "Software") to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */ 
28 
29 module derelict.purple.stun;
30 
31 import core.stdc.time;
32 
33 extern (C):
34 
35 alias _PurpleStunNatDiscovery PurpleStunNatDiscovery;
36 alias _Anonymous_0 PurpleStunStatus;
37 alias _Anonymous_1 PurpleStunNatType;
38 alias void function (_PurpleStunNatDiscovery*) StunCallback;
39 
40 enum _Anonymous_0
41 {
42 	PURPLE_STUN_STATUS_UNDISCOVERED = -1,
43 	PURPLE_STUN_STATUS_UNKNOWN = 0,
44 	PURPLE_STUN_STATUS_DISCOVERING = 1,
45 	PURPLE_STUN_STATUS_DISCOVERED = 2
46 }
47 
48 enum _Anonymous_1
49 {
50 	PURPLE_STUN_NAT_TYPE_PUBLIC_IP = 0,
51 	PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT = 1,
52 	PURPLE_STUN_NAT_TYPE_FULL_CONE = 2,
53 	PURPLE_STUN_NAT_TYPE_RESTRICTED_CONE = 3,
54 	PURPLE_STUN_NAT_TYPE_PORT_RESTRICTED_CONE = 4,
55 	PURPLE_STUN_NAT_TYPE_SYMMETRIC = 5
56 }
57 
58 struct _PurpleStunNatDiscovery
59 {
60 	PurpleStunStatus status;
61 	PurpleStunNatType type;
62 	char[16] publicip;
63 	char* servername;
64 	time_t lookup_time;
65 }
66 
67 
68 version(Derelict_Link_Static)
69 {
70     extern( C ) nothrow 
71     {
72 	    PurpleStunNatDiscovery* purple_stun_discover(StunCallback cb);
73         void purple_stun_init();
74     }
75 }
76 else
77 {
78     extern( C ) nothrow 
79     {
80 	    alias da_purple_stun_discover = PurpleStunNatDiscovery* function(StunCallback cb);		
81         alias da_purple_stun_init = void function();		
82     }
83 
84     __gshared
85     {
86 	    da_purple_stun_discover purple_stun_discover;
87 	    da_purple_stun_init purple_stun_init;
88     }
89 }